/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.uwlaser.modules.quartz.task;

import com.uwlaser.service.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 设备在线定时器
 * @author Zheng Jie
 * @date 2019-01-08
 */
@Slf4j
@Component
public class DeviceTask {

    //设备心跳
    private final DeviceService deviceService;

    public DeviceTask(DeviceService deviceService) {
        this.deviceService = deviceService;
    }


    //定时更新设备在线状态
    public void updateoOnline(){
        try {
            deviceService.updateoOnline();
            log.info("【更新设备在线状态】 执行成功。");
        } catch (Exception e){
            log.error("【更新设备在线状态】 执行失败：" + e.getMessage());
        }
    }

}
